* Read in the 2000-2024

* use "/.../HJMU-original.dta", clear

tsset year

* they include a version of the residuals, we will drop and predict our own, just to be sure
drop res2018

*replicate ideological asymmetry models, PRQ table 3. This is SM Section 2 and forms the basis for the residuals in the main text analysis
**the first line is for the PRQ data starting in 2001
sureg (approvescmacro l.approvescmacro approvecongmacro tooliberalmacro dempres)(approvescmacro l.approvescmacro approvecongmacro tooconservativemacro dempres)(approvescmacro l.approvescmacro approvecongmacro tooliberalmacro tooconservativemacro dempres) if year<=2018 & year>2001
**this line is the replication starting 2000 and ending 2018 for comparison (it's repeated below, too)
sureg (approvescmacro l.approvescmacro approvecongmacro tooliberalmacro dempres)(approvescmacro l.approvescmacro approvecongmacro tooconservativemacro dempres)(approvescmacro l.approvescmacro approvecongmacro tooliberalmacro tooconservativemacro dempres) if year<=2018
***the next two lines generate forecasts and residuals based on the PRQ replication (TABLE 3, MODEL 3) using the data starting 2000 and ending 2018
predict res2018, r equation(3approvescmacro)


* save as our dataset to use in R
save "/.../HJMU-RP-2025.dta", replace


